package com.canxi.games.app;

import com.canxi.common.core.controller.BaseController;
import com.canxi.common.core.domain.PageQuery;
import com.canxi.common.core.domain.R;
import com.canxi.common.core.page.TableDataInfo;
import com.canxi.games.domain.bo.CxGamesBo;
import com.canxi.games.domain.vo.CxGamesVo;
import com.canxi.games.service.ICxGamesService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

/**
 * 游戏列表
 *
 * @author ruoyi
 * @date 2024-08-18
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/games/games")
public class CxAppGamesController extends BaseController {

    private final ICxGamesService iCxGamesService;

    /**
     * 查询游戏列表列表
     */
    @GetMapping("/list")
    public TableDataInfo<CxGamesVo> list(CxGamesBo bo, PageQuery pageQuery) {
        return iCxGamesService.queryPageList(bo, pageQuery);
    }


    /**
     * 获取游戏列表详细信息
     *
     * @param id 主键
     */
    @GetMapping("/{id}")
    public R<CxGamesVo> getInfo(@NotNull(message = "主键不能为空")
                                     @PathVariable String id) {
        return R.ok(iCxGamesService.queryById(id));
    }


}
